<template>
    <div class="main">
        <div class="tree-menu">
            <ul v-for="(menuItem,index) in theModel"
                :key="index">
                <my-tree :model="menuItem"></my-tree>
            </ul>
        </div>

    </div>

</template>

<script>
import myTree from './treemenu'
import { XHeader, Tabbar, TabbarItem, Group, Cell } from 'vux'

export default {
    name: 'App',
    data () {
        return {
            sourceType: '',
            theModel: [],
            userInfo: ''
        }
    },
    components: {
        Tabbar,
        TabbarItem,
        Group,
        Cell,
        XHeader,
        myTree
    },
    created () {
        this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
        this.sourceType = this.$route.query.sourceType
        this.getCompany(this.userInfo.deptid, this.sourceType)
    },
    methods: {
        getCompany (departId, sourceType) {
            var params = {
                'allowPaging': false,
                'business': 'GetDeparts',
                'data': {
                    'deptId': departId,
                    'type': '0'
                },
                'pageIndex': 0,
                'pageSize': 0,
                'tokenId': '81ACEFD7ACEE9BCDE572882A244E72B0',
                'userId': this.userInfo.userid
            }
            this.$axiosAjax.getConfigJson(params)
                .then((res) => {
                    if (res.data.code == 0) {
                        this.theModel = res.data.data
                        this.theModel[0].sourceType = this.sourceType
                    }
                })
        }

    }
}
</script>

<style scoped lang="less">
</style>
